<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="/WEB-INF/templates/template.xhtml">

	<ui:define name="content">
		<h:form>
			<p:panel header="Log Search Form" style="width: 700;">
				<h:form>
					<h:panelGrid columns="3" cellpadding="2">
						<h:outputLabel for="#{logManagedBean.searchPattern}" value="MsgPat" />
						<h:inputText value="#{logManagedBean.searchPattern}" label="MsgPat"></h:inputText>
						<h:commandButton type="submit" value="Search"
							action="#{logManagedBean.searchPattern}"></h:commandButton>
					</h:panelGrid>
				</h:form>
			</p:panel>


			<p:dataTable var="logEntry"
				value="#{logManagedBean.searchLogResults}"
				selection="#{logManagedBean.selectedLogEntry}"
				selectionMode="single" dynamic="true"
				onRowSelectUpdate="logUpdateForm"
				onRowUnselectUpdate="logUpdateForm" paginator="true" rows="10"
				style="width: 700">
				<p:column parser="date" sortBy="#{logEntry.time}"
					>
					<f:facet name="header">
						<h:outputText value="Time" />
					</f:facet>
					<h:outputText value="#{logEntry.time}">
						<f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss" />
					</h:outputText>
				</p:column>
				<p:column sortBy="#{logEntry.type}" filterBy="#{logEntry.type}" filterOptions="#{logManagedBean.typeOptions}" >
					<f:facet name="header">
						<h:outputText value="Type" />
					</f:facet>
					<h:outputText value="#{logEntry.type}">
					</h:outputText>
				</p:column>
				<p:column sortBy="#{logEntry.user.name}"
					filterBy="#{logEntry.user.name}">
					<f:facet name="header">
						<h:outputText value="User" />
					</f:facet>
					<h:outputText value="#{logEntry.user.name}" />
				</p:column>
				<p:column sortBy="#{logEntry.line.name}"
					filterBy="#{logEntry.line.name}">
					<f:facet name="header">
						<h:outputText value="Line" />
					</f:facet>
					<h:outputText value="#{logEntry.line.name}" />
				</p:column>
				<p:column sortBy="#{logEntry.message}"
					filterBy="#{logEntry.message}">
					<f:facet name="header">
						<h:outputText value="Message" />
					</f:facet>
					<h:outputText value="#{logEntry.message}" />
				</p:column>

			</p:dataTable>
			<p:panel id="logDetailsPanelId" header="Log Details"
				style="width: 700;">
				<h:panelGrid columns="4" cellpadding="2" id="logUpdateForm"
					border="0">
					<h:outputLabel for="#{logManagedBean.selectedLogEntry.time}"
						value="Time" />
					<h:inputText value="#{logManagedBean.selectedLogEntry.time}"
						style="width: 100;" readonly="true"></h:inputText>

					<h:outputLabel for="#{logManagedBean.selectedLogEntry.user.name}"
						value="User" />
					<h:inputText value="#{logManagedBean.selectedLogEntry.user.name}"
						readonly="true"></h:inputText>

					<h:outputLabel for="#{logManagedBean.selectedLogEntry.line.name}"
						value="Line" />
					<h:inputText value="#{logManagedBean.selectedLogEntry.line.name}"
						readonly="true"></h:inputText>
				</h:panelGrid>
			</p:panel>
		</h:form>
	</ui:define>

</ui:composition>
</html>